﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Draco.OWF.RT;
using Draco.OWF.Exceptions;

namespace Draco.OWF.Acticity
{
    public abstract class AbstractActivityInstance : ITask
    {
        protected IActivity m_Activity;
        protected Stack<ActivityRuntimeException> m_Exceptions = new Stack<ActivityRuntimeException>();
        protected ActivityStatus m_Status = ActivityStatus.Wait;
        public bool IsStart{get;set;}
        public ActivityStatus Status { get { return m_Status; } set { m_Status = value; } }
        public IActivity Activity
        {
            get { return m_Activity; }
        }
        public string Id{get;set;}
       
        /// <summary>
        /// constructor
        /// </summary>
        /// <param name="activity"></param>
        public AbstractActivityInstance(IActivity activity)
        {
            if (activity == null)
                throw new ArgumentNullException("activity");
            m_Activity = activity;
        }

        /// <summary>
        /// RuntimeExceptions
        /// </summary>
        public Stack<ActivityRuntimeException> Exceptions
        {
            get { return m_Exceptions; }
        }

        public abstract bool Excute(IJobContext context);


        public virtual void Initialize()
        {
            
        }
    }
}
